package com.we.wecc.us.mid.impl;

import com.we.wecc.us.db.mapper.ActUserMapper;
import com.we.wecc.us.db.model.ActUser;
import com.we.wecc.us.db.model.ActUserExample;
import com.we.wecc.us.mid.service.ActUserService;
import com.x.share.mid.exception.HelperException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ActUserImpl implements ActUserService {

    @Resource
    ActUserMapper actUserMapper;

    @Override
    public ActUser getActUser(Long userId) {
        ActUserExample ex = new ActUserExample();
        ex.or().andUserIdEqualTo(userId);
        List<ActUser> list = actUserMapper.selectByExample(ex);
        if(list.isEmpty()){
            throw new HelperException("该用户不存在！");
        }
        return list.get(0);
    }
}
